<!-- Charts are generated in SVG format, no 3rd party libraries are used (even Tee)
-->
<style>
 {{{defaultstyle}}}
 body {width: 100%; padding: 20px 10px; background: white; }
 h3 {color: #666;}
 text:hover {font-weight: bold}
 .sector-top {transition: all 0.2s}
 .sector-top:hover {font-weight: bold; transform: translate(0px, -10px); fill-opacity: 0.5; z-index: 1}
 .vbar g:hover {fill-opacity: 0.7}
 .bar g:hover {fill-opacity: 0.7}
 circle:hover {opacity: 0.5}
 h3 {margin-bottom: 5px}
 svg {  border: solid #eee 1px; resize: both;
  border-radius: 10px;
  font-family: Arial;
  font-size: 12px;
  color: #777;
  box-shadow: 3 3 5 #aaa;
  margin: 10 0;
  padding: 10 10;
  page-break-after: always;
 }
</style>
<script type="passcript"></script>
<h3>Sales by Managers (Donut)</h3>

<CHART width="800" height="400" active="true">
 <LEGEND position="right"/>
 <SERIES>
  <S  type="pie" x="lastname" y="=sales/2" donut="30" />
 </SERIES>
 <SQL>
  select first 10 * from (
   select
   e.firstname, e.lastname, sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
  )
 </SQL>
</CHART>


<h3>Areas - top 10 (Pie) </h3>

<CHART width="800" height="500" active="true" >
 <COLORS hue_step="50" sat_step="20"/>
 <SERIES>
  <S  type="pie" x="name" y="area" />
 </SERIES>
 <LEGEND position="bottom"/>
 <SQL>
  select first 10 * from (
   select  * from country order by area desc
  )
 </SQL>
</CHART>


<h3>Horizontal Bars</h3>

<CHART width="750" height="400" active="true">
 <SERIES>
  <S  type="bar" x="lastname" y="sales"/>
 </SERIES>
 <SQL>
  select first 10 * from (
   select
   e.firstname, e.lastname, -1*sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
  )
 </SQL>
</CHART>

<h3>Vertical Bars</h3>

<CHART width="750" height="400" active="true">
 <SERIES>
  <S  type="vbar" x="lastname" y="sales" />
 </SERIES>
 <SQL>
  select first 10 lastname, sales, sales/10000 +1 q2, sales/10000 - 3 q1, sales/10000 + 3 q3, sales/10000 - 3 - rand()*10 qmin, sales/10000 + 8 qmax from (
   select
   e.firstname, e.lastname, sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
   )
 </SQL>
</CHART>


<h3>Vertical Bars - stats</h3>

<CHART width="750" height="400" active="true">
 <SERIES>
  <S  type="vbar" x="lastname" q1="q1" q2="q2" q3="q3" qmin="qmin" qmax="qmax" boxplot="true"/>
 </SERIES>
 <SQL>
  select first 10 lastname, sales, sales/10000 +1 q2, sales/10000 - 3 q1, sales/10000 + 3 q3, sales/10000 - 3 - rand()*10 qmin, sales/10000 + 8 qmax from (
   select
   e.firstname, e.lastname, sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
   )
 </SQL>
</CHART>

<h3>Stacked Bars</h3>

<CHART width="750" height="550" active="true">
 <SERIES>
  <S type="bar" x="lastname" y="sales" stack="syear" error="e" percent3d="0" />
 </SERIES>
 <SQL>
  select first 80 x.*,  '10000' as e from (
   select
    e.firstname, e.lastname, extract(year from saledate) syear, sum(o.itemstotal) sales
    from customer c join orders o on o.custno=c.custno
    join employee e on e.empno=o.empno
    group by 1, 2,3
    order by 1,2,3
   ) x
 </SQL>
</CHART>

<h3>Vertical Stacked Bars</h3>

<CHART width="900" height="400" active="true">
 <SERIES>
  <S  type="vbar" x="lastname" y="sales" stack="syear" percent3d="0" marks="true" />
 </SERIES>
 <SQL>
  select first 80 x.*,  '10000' as e from (
   select
    e.firstname, e.lastname, extract(year from saledate) syear, sum(o.itemstotal) sales
    from customer c join orders o on o.custno=c.custno
    join employee e on e.empno=o.empno
   group by 1, 2,3
   order by 1,2,3
  ) x
 </SQL>
</CHART>

<h3>Side-by-Side Bars</h3>

<CHART width="1350" height="400" active="true">
 <SERIES>
  <S  type="vbar" x="lastname" y="sales" stack="syear" percent3d="0" sidebyside="true"/>
 </SERIES>
 <SQL>
  select first 80 x.*,  '10000' as e from (
   select
    e.firstname, e.lastname, extract(year from saledate) syear, sum(o.itemstotal) sales
    from customer c join orders o on o.custno=c.custno
    join employee e on e.empno=o.empno
   group by 1, 2,3
   order by 1,2,3
  ) x
 </SQL>
</CHART>

<h3>Areas</h3>

<CHART width="750" height="400" active="true">
 <SERIES>
  <S  type="area" x="lastname" y="sales" />
 </SERIES>
 <SQL>
  select first 10 lastname, sales/100000 sales from (
   select
   e.firstname, e.lastname, sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
   )
 </SQL>
</CHART>



<h3>Lines</h3>

<CHART width="750" height="400" active="true">
 <SERIES>
  <S  type="line" x="lastname" y="sales" />
 </SERIES>
 <SQL>
  select first 10 lastname, sales/100000 sales from (
   select
   e.firstname, e.lastname, sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
   )
 </SQL>
</CHART>

<h3>Scatter</h3>

<CHART width="750" height="400" active="true">
 <SERIES>
  <S  type="scatter" x="lastname" y="sales" hint="='Value is <b>'+FormatFloat('0.00', sales)+'</b>'"/>
 </SERIES>
 <SQL>
  select first 10 lastname, sales/100000 sales from (
   select
   e.firstname, e.lastname, sum(o.itemstotal) sales
   from customer c join orders o on o.custno=c.custno
   join employee e on e.empno=o.empno
   group by 1, 2
   order by 3 desc
   )
 </SQL>
</CHART>

<h3>Bubble</h3>
<CHART width="800" height="400" active="true">
 <LEGEND position="right"/>
 <SERIES>
  <S  type="bubble" x="lastname" z="XCOUNT" y="SALES" hint="XCOUNT" />
 </SERIES>
 <SQL>
   select first 20 * from (
    select e.firstname, e.lastname, sum(o.itemstotal) sales, count(*) xcount
    from customer c join orders o on o.custno=c.custno
    join employee e on e.empno=o.empno
   group by 1, 2
   order by 1,2
   )
 </SQL>
</CHART>


